package com.location.footprint.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.location.footprint.R;
import com.location.footprint.bean.FootPrintBean;
import com.location.footprint.utils.GlideUtils;

import java.util.List;

import de.hdodenhof.circleimageview.CircleImageView;


public class FootPrintAdapter extends BaseMultiItemQuickAdapter<FootPrintBean, BaseViewHolder> {

    public FootPrintAdapter(List data) {
        super(data);
        addItemType(FootPrintBean.TEXT_IMG, R.layout.item_list_layout_text_img);
        addItemType(FootPrintBean.VISITING, R.layout.item_list_layout_visiting);
    }

    @Override
    protected void convert(BaseViewHolder helper, FootPrintBean item) {
        ImageView imgPhoto = helper.getView(R.id.img_photo);
        GlideUtils.loadImageViewSize(mContext, item.getPhotoPath(), imgPhoto.getWidth(), imgPhoto.getHeight(), imgPhoto);
        TextView text_time = helper.getView(R.id.text_time);
        text_time.setText(item.getPublishTime());
        TextView text_content = helper.getView(R.id.text_content);
        text_content.setText(item.getContent());
        TextView text_address = helper.getView(R.id.text_address);
        text_address.setText(item.getAddress());
        TextView text_like = helper.getView(R.id.text_like);
        text_like.setText(item.getLike());
        TextView text_comments = helper.getView(R.id.text_comments);
        CircleImageView img_avatar = helper.getView(R.id.img_avatar);
        GlideUtils.loadImageView(mContext, item.getAvatarPath(), img_avatar);
        switch (helper.getItemViewType()) {
            case FootPrintBean.TEXT_IMG:
                TextView text_name = helper.getView(R.id.text_name);
                text_name.setText(item.getNickName());

                break;
            case FootPrintBean.VISITING:


                break;
            case FootPrintBean.HEADER:

                break;
        }
    }

}
